package com.hzit.login.controller;

import com.hzit.auth.vo.UserVo;
import com.hzit.common.util.R;
import com.hzit.login.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@RestController
@RequestMapping
public class UserController {
	@Autowired
	private IUserService userService;
	//1. 用户登录
	@GetMapping("/user/login")
	public R login(@RequestBody UserVo vo){
		Map<String,String> map = userService.login(vo);
		return R.ok(map);
	}

	@GetMapping("/test/list")
	@PreAuthorize("hasAuthority('user:userlist')")
	public R list(){
		return R.ok();
	}
}
